{{- $params := .Site.Params -}}
{{- $params = merge $params (dict "baseURL" .Site.BaseURL) -}}
{{- $options := dict "target" "es2015" "targetPath" "assets/main/bundle.min.js" "minify" hugo.IsProduction "params" $params -}}
{{- $main := resources.Get "main/js/index.ts" }}
{{- $scripts := slice $main -}}
{{- if .Site.Params.utterances -}}
  {{- $scripts = $scripts | append (resources.Get "js/utterances/index.ts") -}}
{{- end -}}
{{- if .Site.Params.giscus -}}
  {{- $scripts = $scripts | append (resources.Get "js/giscus/index.ts") -}}
{{- end -}}
{{- if .Site.Params.staticman -}}
  {{- $scripts = $scripts | append (resources.Get "js/staticman/index.ts") -}}
{{- end -}}
{{- $script := $scripts | resources.Concat "main/js/bundle.ts" | js.Build $options | fingerprint -}}
<script data-precache src="{{ $script.RelPermalink }}" crossorigin="anonymous" async></script>
<!-- <script data-precache src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}" crossorigin="anonymous" async></script> -->
{{- range .Site.Params.customJS -}}
<script data-precache src="{{ absURL . }}" crossorigin="anonymous"></script>
{{- end -}}
